home *** CD-ROM | disk | FTP | other *** search
-
-
- Text File _perform.rem
-
-
- Are you running this Batch File from a hard disk or an "electronic" or "RAM"
- disk? If not, then the first performance improvement that you might make (to
- your entire system!) is to obtain "electronic disk" software and enough memory
- to support it. The dramatic improvement in the performance of your system will
- more than compensate for the bucks spent. Batch Files are extremely "disk
- bound", meaning that the disk is accessed for almost every command line
- (comments are buffered somewhat), and an electronic disk will eliminate the
- annoying "crank! crank!" of the floppy drive grinding through each line of the
- Batch File. For any serious work on the PC, be it user applications or program
- development, electronic disk software is indispensable; once hooked on this
- high-performance addition to your PC, you won't understand how you survived
- without it. (If you must run on floppies, try to locate Batch Files as the
- first files on the diskette; this will noticably reduce seek time).
-
- Well, that was an expensive piece of editorial advice! What can we do for FREE
- to further improve Batch File performance? One improvement is just what we are
- doing here: putting long-winded comments into text files instead of into Batch
- File comment lines. There is an important reason for keeping the size of Batch
- Files as small as possible and still get the job done. The Batch File
- processor is a text interpreter. One unfortunate consequence of this is that
- each time the processor encounters a "goto :label" subcommand, it starts at the
- top of our Batch File and searches, line by line, for the statement that
- contains the text ":label", the destination of the "goto" jump. On short Batch
- Files, there is no discernible penalty for this linear search for the label.
- But in longer Batch Files, the time penalty for finding labels near the bottom
- of the file can be long and irritating. Displaying text out of text files
- instead of Batch File comment lines is one way to cut down the file size;
- another way is to design a large Batch File function as a series of small Batch
- Files that "call" each other. This kind of modular programming (and that's
- what Batch Files are, command line programs!) helps us to create Batch Files
- that are easy to develop, debug, understand, and maintain. We'll show examples
- of this further on.
-
- This does not mean that we should avoid visible comments completely. When we
- do display short visible comments, there are some tricks to make them compact
- and readable. Let's end this text file and go back to the Batch File
- execution, and look at some examples of comments.